{% extends "view.html" %}

{% set issue = context[scaffolding.singular] %}

{% block layout_head_title %} - {{ s.print_value(issue.publication) }} {{ s.print_value(issue.number) }}{% endblock %}

{% block view_header %}
    <a href="{{ uri('magazines:view', key=issue.publication.urlsafe()) }}">{{ s.print_value(issue.publication) }}</a> {{ issue.number_period_year() }}
{% endblock %}

{% block view_detail %}
    {% if issue.link %}
        <h4><a href="{{ issue.link }}" target="_blank">{{ issue.link_short() }}</a></h4>
    {% endif %}
    {% if issue.cover %}
        <h4>cover: {{ issue.cover }}</h4>
    {% endif %}
{% endblock %}

{% block table_head %}
    <th>column</th>
    <th>feature title</th>
    <th>artist</th>
    <th></th>
{% endblock %}

{% block table_body %}

    {% for item in context['related'] %}
        <tr>
            <td><a href="{{ uri('columns:view', key=item['column'].urlsafe()) }}">{{ s.print_value(item['column'] )}}</a></td>
            <td>{{ item['description'] }}</td>
            <td>{% if item['artist'] %}<a href="{{uri('artists:view', key=item['artist'].urlsafe())}}">{{ s.print_value(item['artist']) }}</a>{% endif %}</td>
            <td class="text-right">
                {{ buttons.view_edit_delete_buttons(item, controller='features', target='feature') }}
            </td>
        </tr>
    {% endfor %}

{% endblock %}